/**
 * Created by fangshufeng on 2017/9/22.
 */


import  React from 'react';

import HigherOrderComponentBase from './HigherOrderComponentBase';

function ComponentFactory(WrappedComponent) {

     return class   extends React.Component {
        render(){
            const newProps = {
                name:'----我是修改过的属性',
            }
            /***
             * 通过这种方式可以过滤掉和高阶组件相同的属性
             */
            let {name,...passthroughProps} = this.props;

            return <WrappedComponent {...passthroughProps} {...newProps}/>;
        }
    } ;
}

export const ComponentBase = () => {
    const PP =  ComponentFactory(HigherOrderComponentBase);
    return <PP name={'--我是传进的参数'} />;
};